<layout name='Layout/layout_main' />
<script type="text/javascript" src="__PUBLIC__/editor/kindeditor.js"></script>
<script type="text/javascript" src="__PUBLIC__/editor/kindeditor.setting.js"></script>
<script type="text/javascript">
	// 加载编辑器
	function save(step) {
		$("#confirm").val("");
		$("#confirm_wrap  span").each(function() {
			$("#confirm").val($("#confirm").val() + $(this).attr("emp_no") + '|');
		})
		$("#confirm_name").val($("#confirm_wrap").html());
		$("#consult").val("");
		$("#consult_wrap  span").each(function() {
			$("#consult").val($("#consult").val() + $(this).attr("emp_no") + '|');
		})
		$("#consult_name").val($("#consult_wrap").html());

		$("#refer").val("");
		$("#refer_wrap  span").each(function() {
			$("#refer").val($("#refer").val() + $(this).attr("emp_no") + '|');
		})
		$("#refer_name").val($("#refer_wrap").html());

		if ($("#confirm").val().length < 2) {
			alert('请选择审批流程');
			return
		}
		$("#step").val(step);
		editor.sync();
		if(check_form("form_data")){
			sendForm("form_data", "{:U('save')}");
		}
	}

	function select_confirm() {
		winopen("{:U('popup/confirm')}", 900, 750);
	};

	$(document).ready(function() {
		$("#confirm span").live("dblclick", function() {
			$("#confirm span").last().find("b").remove();
		});
		$("#consult span").live("dblclick", function() {
			$("#consult span").last().find("b").remove();
		});
		// swfupload
		
		editor_init();
		
	}); 
</script>
<div class="flow">
    <div class="row-fluid title">
        <span>编辑:{$flow_type.name}</span>
    </div>
	<div class="row-fluid operate">
		<div class="left">
			<a onclick="go_return_url();" class="btn">返回</a>
			<a onclick="select_confirm();"  class="btn">选择审批流程</a>
		</div>
		<div class="right">
			<a onclick="save(10);"  class="btn">临时保存</a>
			<a onclick="save(20);"  class="btn">提交</a>
		</div>
	</div>
	<form method='post' id="form_data" name="form_data" enctype="multipart/form-data">
		<input type="hidden" id="id" name="id" value="{$vo.id}">
		<input type="hidden" id="ajax" name="ajax" value="0">
		<input type="hidden" id="add_file" name="add_file" >
		<input type="hidden" id="type" name="type" value="{$flow_type.id}">
		<input type="hidden" id="opmode" name="opmode" value="edit">
		<input type="hidden" id="confirm" name="confirm" value="">
		<input type="hidden" id="confirm_name" name="confirm_name" value="">
		<input type="hidden" id="consult" name="consult" value="">
		<input type="hidden" id="consult_name" name="consult_name" value="">
		<input type="hidden" id="refer" name="refer" value="">
		<input type="hidden" id="refer_name" name="refer_name" value="">
		<input type="hidden" id="step" name="step" value="">
		<div class="row-fluid form_box">
				<div class="row-fluid form-horizontal">
						<div class="control-group">
								<label class="control-label" for="title">标题：</label>
								<div class="controls">
										<input type="text" id="title" name="title" class="span12" value="{$vo.title}"  check="require" msg="请输入标题">
								</div>
						</div>
				</div>
				<div class="row-fluid form-horizontal">
						<div class="control-group span12">
								<label class="control-label" >日期：</label>
								<div class="controls">
										{$vo.create_time|toDate='Y-m-d'}
								</div>
						</div>
				</div>
				<div class="row-fluid form-horizontal">
						<div class="control-group span12">
								<label class="control-label" >编写人：</label>
								<div class="controls">
										{$vo.user_name}
								</div>
						</div>
				</div>
				<div class="row-fluid form-horizontal">
						<div class="control-group span12">
								<label class="control-label" >部门：</label>
								<div class="controls">
										{$vo.dept_name}
								</div>
						</div>
				</div>
				<div class="row-fluid form-horizontal">
						<div class="control-group">
								<label class="control-label" >裁决：</label>
								<div class="controls">
									<div id="confirm_wrap" class="address_list">
										{$vo.confirm_name}
									</div>
								</div>
						</div>
				</div>
				<div class="row-fluid form-horizontal">
						<div class="control-group">
								<label class="control-label" >协商：</label>
								<div class="controls">
									<div id="consult_wrap" class="address_list">
										{$vo.consult_name}
									</div>
								</div>
						</div>
				</div>
				<div class="row-fluid form-horizontal">
						<div class="control-group">
								<label class="control-label" >抄送：</label>
								<div class="controls">
									<div id="refer_wrap" class="address_list">
										{$vo.refer|show_confirm}
									</div>
								</div>
						</div>
				</div>
				<div class="row-fluid form-horizontal">
						<div class="control-group">
								<label class="control-label" >附件：</label>
								<div class="controls">
									<include file="Layout:uploader" />
								</div>
						</div>
				</div>
				<div class="row-fluid form-horizontal">
						<div class="control-group">
								<textarea id="content" name="content" style="width:100%;height:300px;">{$flow_type.content}
								</textarea>
						</div>
				</div>
		</div>
	</form>
</div>